import axios from 'axios';
import jQuery from 'jquery'

let base = 'http://192.168.1.121:8099/javaWebSocket';

export const requestLogin = params =>{
	return axios.post(`/login`,params).then(res => res.data);
};

export const getUserList = params =>{
	return axios.get(`/user/list`,{params:params});
};

export const getUserListPage = params =>{
	return axios.get(`/user/listpage`,{params:params});
};

export const removeUser = params =>{
	return axios.get(`/user/remove`,{params:params});
};

export const batchRemoveUser = params =>{
	return axios.get(`/user/batchremove`,{params:params});
};

export const editUser = params =>{
	return axios.get(`/user/edit`,{params:params});
};

export const addUser = params =>{
	return axios.get(`/user/add`,{params:params});
};

export const APIGetTechnicianList = params =>{
	return axios.get(`${base}/cartonOptimization/getRoleList`).then(res => res.data);
}

export const sendRequest = (url,param,func) =>{
	jQuery.ajax({
		type:"post",
		url: base + url,
		async:false,
		data:JSON.stringify(param),
		contentType:"application/json;charset=utf-8",
		success:function(data){
			func(data);
		}
	});
}


